package main

import (
	"Logger"
	"net"
	"os"
)

func setLogger() {
	Logger.SetConsole(true)
	Logger.SetRollingDaily("../logs", "Logic-logs.txt")
}

func main() {
	conn, err := net.Dial("tcp", "localhost:3000")
	checkError(err, false)
	conn.Write([]byte("LOGIC"))
	buffer := make([]byte, 128)
	for {
		length, err := conn.Read(buffer)
		print("saddsa")
		checkError(err, true)
		//Logger.Info(buffer[:length])
		conn.Write(buffer[:length])
	}
}

func checkError(e error, crash bool) bool {
	if e != nil {
		Logger.Error(e.Error())
		if crash {
			os.Exit(444)
		}
		return true
	}
	return false
}
